<?php
/**
 * Created by PhpStorm.
 * User: keyth
 * Date: 18-4-8
 * Time: 下午7:09
 */
namespace app\model;
use think\Model;

class Student extends Model
{
    static public function Stu_reg($postdata){
        if(!empty($postdata['id'])){
            $Teacher=self::get($postdata['id']);
        }else{
            $Teacher=new self();
            $Teacher->password=encrypt_pass($postdata['email'],$postdata['password']);
        }
        $Teacher->address=$postdata['address'];
        $Teacher->sex=$postdata['sex'];
        $Teacher->age=$postdata['age'];
        $Teacher->email=$postdata['email'];
        $Teacher->mobile=$postdata['mobile'];
        $Teacher->username=$postdata['username'];

        $state=$Teacher->save();
        if($state)
            return 1;
        return 0;
    }

}